package com.hzvdvmc.autosale.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.hzvdvmc.autosale.setting.ui.LoginActivity;

public class LoginSetReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        // an Intent broadcast.
        String action = intent.getAction();
        if(action.equals("android.intent.action.ENG_MODE_SWITCH")){
            int state = intent.getIntExtra("state",1);
            boolean mIsEngMode = state == 1 ? true:false;
            if (mIsEngMode) {
                Intent inte = new Intent(context, LoginActivity.class);
                inte.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(inte);
            }
        }
    }
}
